<%--
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="layui/css/layui.css" rel="stylesheet">
    <style>
        .layui-body{
            width: 277px;
            background-color: #ffb41e;
        }
    </style>
</head>
<script type="application/javascript" src="js/jquery-3.7.1.js"></script>
<script type="application/javascript">

</script>
<body>
<div class="layui-body">
    <form action="/bank">
        <h1>新增网点信息</h1>
        <input type="hidden" name="action" value="addGame">
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix" >
                网点名称
            </div>
            <input type="text" class="layui-input" required="required" name="name" value="">
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix" >
                营业执照号
            </div>
            <input type="text" class="layui-input" name="businessNo" value="">
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix" >
                所在城区
            </div>
            <input type="text" class="layui-input" name="cityArea" value="">
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix" >
                联系电话
            </div>
            <input type="text" class="layui-input" name="telephone" value="">
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix" >
                网点简介
            </div>
            <input type="text" class="layui-input" name="summary" value="">
        </div>
        <p><input class="layui-btn layui-btn-normal" type="submit" value="添加"></p>
    </form>
</div>
</body>
</html>
--%>



<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新增网点信息</title>
    <link href="layui/css/layui.css" rel="stylesheet">
    <style>
        .layui-body {
            width: 277px;
            background-color: #ffb41e;
        }
        .error-message {
            color: red;
            margin-left: 10px;
        }
    </style>
    <script type="application/javascript" src="js/jquery-3.7.1.js"></script>
    <script type="application/javascript">
        $(document).ready(function () {
            /*$("input[name='businessNo']").on('blur', function () {
                var businessNo = $(this).val();
                if (businessNo !== "") {
                    $.ajax({
                        url: "/bank",
                        data: {
                            action:noQueryBank,
                            businessNo: businessNo,
                        },
                        type: "GET",
                        dataType: "json",
                        success: function (data) {
                            if (data.msg.equals("")) {
                                location.href="/bank?action=addBank?businessNo="+
                            } else {
                                alert(data.msg)
                                location.href="addBank.jsp"
                            }
                        }
                    });
                }
            });*/

            $("form").on('submit', function (event) {
                var valid = true;
                $(".layui-input").each(function () {
                    if ($(this).val() === "") {
                        valid = false;
                        $(this).next(".error-message").text("该字段不能为空");
                    } else {
                        $(this).next(".error-message").text("");
                    }
                });
                if (!valid) {
                    event.preventDefault();
                }
            });
        });
    </script>
</head>
<body>
<div class="layui-body">
    <form action="/bank">
        <h1>新增网点信息</h1>
        <input type="hidden" name="action" value="addBank">
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                网点名称
            </div>
            <input type="text" class="layui-input"  name="name" value="">
            <span class="error-message"></span>
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                营业执照号
            </div>
            <input type="text" class="layui-input" name="businessNo" value="">
            <span id="businessNoError" class="error-message"></span>
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                所在城区
            </div>
            <input type="text" class="layui-input" name="cityArea" value="">
            <span class="error-message"></span>
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                详细地址
            </div>
            <input type="text" class="layui-input" name="address" value="">
            <span class="error-message"></span>
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                联系电话
            </div>
            <input type="text" class="layui-input" name="telephone" value="">
            <span class="error-message"></span>
        </div>
        <div class="layui-input-group">
            <div class="layui-input-split layui-input-prefix">
                网点简介
            </div>
            <input type="text" class="layui-input" name="summary" value="">
            <span class="error-message"></span>
        </div>
        <p><input class="layui-btn layui-btn-normal" type="submit" value="添加"></p>
    </form>
</div>
</body>
</html>
